<?php defined('APP_PATH') or exit('Access Denied');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新闻列表</title>
<link rel="stylesheet" type="text/css" href="vonuo/static/css/vonuo.css">
<script type="text/javascript" src="vonuo/static/js/jquery.min.js"></script>
<script type="text/javascript" src="vonuo/static/js/tablecolor.js"></script>
<script type="text/javascript">
function pldel(){
	var i = 0;
	$("input[name='id[]']").each(function(){
		if($(this).attr('checked')){
			i++;
		}
	});
	if(i == 0){
		alert('请选择要删除的编号');
		return false;
	}
	if(confirm('确定批量删除？')){
		$('form:eq(1)').attr('action','<?php echo spUrl('news','pldel');?>').submit();
	}else{
		return false;
	}
}
</script>
</head>

<body>
<div class="gs_wraper gs_p_l0">
	<div class="tab_box">
		<table border="0" cellspacing="0" cellpadding="0" class="table_btm">
			<tr>
				<form action="<?php echo spUrl('news','lis');?>" method="post">
				<td>
					<label class="txt_s_blue">新闻分类：</label><select name="search[cid]" class="blue_input input_w_150">
					<option></option>
					<?php foreach($ncat as $row){?>
						<option value="<?php echo $row['id'];?>" <?php if($row['id']==$search['cid']){?>selected="selected"<?php }?>><?php echo $row['format'];?></option>
					<?php }?>
					</select>
					<label class="txt_s_blue">新闻标题：</label><input name="search[title]" value="<?php echo $search['title'];?>" type="text" class="blue_input input_w_150" />
				</td>
				</form>
				<td><a href="javascript:;" onclick="$('form:eq(0)').submit()" class="btn_select">查 询</a></td>
			</tr>
		</table>
		<table width="100%" border="0" cellpadding="0" cellspacing="0"  class="common_table">
			<tr>
				<th width="70"><input type="checkbox" onclick="$('.all_check').attr('checked',$(this).attr('checked'))" class="all_check" /><label>编号</label></th>
				<th width="250">新闻标题</th>
				<th width="100">所属分类</th>
				<th>是否显示</th>
				<th>是否置顶</th>
				<th>浏览次数</th>
				<th>指定排序</th>
				<th width="150">发布时间</th>
				<th width="100">新闻管理</th>
			</tr>
			<form action="" method="post">
			<?php foreach($news as $row){?>
			<tr>
				<td><input name="id[]" type="checkbox" value="<?php echo $row['id'];?>" class="all_check" /><label><?php echo $row['id'];?></label></td>
				<td><a href="/index.php?c=main&a=news&id=<?php echo $row['id'];?>" target="_blank"><?php echo $row['title'];?></a></td>
				<td><?php echo $row['ncat']['ncatname'];?></td>
				<td><?php if($row['visible']){?>显示<?php }else{?><span style="color:red;">隐藏</span><?php }?></td>
				<td><?php if($row['stick']){?><span style="color:red;">置顶</span><?php }else{?>正常<?php }?></td>
				<td><input name="views[]" type="text" class="blue_input input_w_40" value="<?php echo $row['views'];?>"/></td>
				<td><input name="odnum[]" type="text" class="blue_input input_w_40" value="<?php echo $row['odnum'];?>"/></td>
				<td><?php echo date('Y-m-d H:i:s', $row['time']);?></td><input name="idrow[]" value="<?php echo $row['id'];?>" type="hidden" />
				<td><a href="<?php echo spUrl('news','upd',array('id'=>$row['id']));?>">[编辑]</a><a href="<?php echo spUrl('news','del',array('id'=>$row['id']));?>" onclick="return confirm('确定删除？');">[删除]</a></td>
			</tr>
			<?php }?>
			</form>
			<tr class="bottom">
				<td colspan="2" align="left" valign="middle">
					<a href="javascript:;" onclick="return pldel();" class="btn_wei f_left">批量删除</a>
					<a href="javascript:;" onclick="$('form:eq(1)').attr('action','<?php echo spUrl('news','updvs');?>').submit()" class="btn_wei f_left">更新浏览</a>
					<a href="javascript:;" onclick="$('form:eq(1)').attr('action','<?php echo spUrl('news','updod');?>').submit()" class="btn_wei f_left">更新排序</a>
				</td>
				<td colspan="7" align="right" valign="middle">
				<?php if($pager){?>
					<a href="javascript:;" onclick="location.href=('<?php echo spUrl('news','lis',array('cid'=>$search['cid'],'title'=>urlencode($search['title'])));?>&page='+(document.getElementById('gopage').value > <?php echo $pager['total_page'];?> ? <?php echo $pager['total_page'];?> : document.getElementById('gopage').value))" class="btn_jump f_right m_t_3">跳转</a>
					<span class="txt_color">每页<?php echo $pager['page_size'];?>条/共<?php echo $pager['total_count'];?>条记录</span>
					<span class="txt_color">当前<?php echo $pager['current_page'];?>/<?php echo $pager['total_page'];?>页</span>
					<?php if($pager['current_page']!=$pager['first_page']){?><a href="<?php echo spUrl('news','lis',array('page'=>$pager['first_page'],'cid'=>$search['cid'],'title'=>urlencode($search['title'])));?>">首页</a><?php }else{?><a href="javascript:;">首页</a><?php }?>
					<a href="<?php echo spUrl('news','lis',array('page'=>$pager['prev_page'],'cid'=>$search['cid'],'title'=>urlencode($search['title'])));?>">上一页</a>
					<a href="<?php echo spUrl('news','lis',array('page'=>$pager['next_page'],'cid'=>$search['cid'],'title'=>urlencode($search['title'])));?>">下一页</a>
					<?php if($pager['current_page']!=$pager['last_page']){?><a href="<?php echo spUrl('news','lis',array('page'=>$pager['last_page'],'cid'=>$search['cid'],'title'=>urlencode($search['title'])));?>">末页</a><?php }else{?><a href="javascript:;">末页</a><?php }?>
					<label>第</label><input type="text" class="page_input" id="gopage" size="3" value="<?php echo $pager['current_page'];?>" /><label>页</label>
				<?php }?>
				</td>
			</tr>
  		</table>
	</div>
</div>
</body>
</html>